package com.ball.dao;

import com.ball.entity.Log;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface LogMapper   {
    @Insert("insert into log(id,username,log,time) values(null,#{username},#{log},#{time})")
    void add(Log log);

    @Update("update log set username=#{username},log=#{log},time=#{time} where id = #{id}")
    void update(Log log);

    @Delete("delete from log where id= #{id}")
    void deleteLogById(@Param("id") int id);

    @Delete("delete from log where username= #{username}")
    void deleteLogByName(@Param("username") String username);

    @Select("select * from log  where id= #{id}")
    Log queryLogById(@Param("id") int id);

    @Select("select * from  log order by id desc")
    List<Log> queryLogList();

    @Select("select * from log where username=#{username}")
    List<Log> queryLogByUsername(@Param("username") String username);

}
